function buildPlupload(config) {
	var id = config.id;
	var elmName = config.elmName;
	var targetUrl = config.targetUrl;
	var defaultVal = config.defaultVal;
	var btnName = config.btnName || "上传文件";
	var filters = config.filters;
	var tips = config.tips;

	var container = $("#" + id);
	var uploadIconInput = $("<input >").attr("type", "hidden").attr("id",
			id + "Input").attr("name", elmName);
	var uploadIconInputName = $("<input >").attr("type", "hidden").attr("id",
			id + "Name").attr("name", elmName + "Name");
	var uploadIconInputSize = $("<input >").attr("type", "hidden").attr("id",
			id + "Size").attr("name", elmName + "Size");
	uploadIconInput.val(defaultVal);
	container.append(uploadIconInput);
	container.append(uploadIconInputName);
	container.append(uploadIconInputSize);
	var uploadIconBtn = $("<a>" + btnName + "</a>").attr("id", id + "Btn")
			.attr("style", "float:left;cursor: pointer").addClass(
					"btn btn-primary btn-small");
	container.append(uploadIconBtn);
	var uploadIconShow = $("<div></div>").attr("id", id + "Show").attr("style",
			"float:left;line-height:30px;margin-left:20px;");
	var uploadIconName = $("<span/>").attr("id", id + "Name");
	var uploadIconProcess = $("<span/>").attr("id", id + "Process");
	var uploadIconStop = $("<a>取消</a>").attr("id", id + "Stop").attr("style",
			"cursor: pointer;display:none").addClass("btn-small tls");
	uploadIconShow.append(uploadIconName);
	uploadIconShow.append(uploadIconProcess);
	uploadIconShow.append(uploadIconStop);
	container.append(uploadIconShow);

	if (filters) {
		var uploader = new plupload.Uploader({
			runtimes : 'html5',
			browse_button : uploadIconBtn.attr("id"),
			container : id,
			max_file_size : '100mb',
			url : targetUrl,
			resize : {
				width : 2000,
				height : 2000,
				quality : 100
			},
			filters : filters
		/*
		 * , filters : [ {title : "Image files", extensions :
		 * "jpg,gif,png,zip,apk,ipa,plist"}, {title : "Zip files", extensions :
		 * "zip,apk,ipa,plist"}, {title : "DOC files", extensions :
		 * "doc,docx,xls,xlsx,ppt,pptx,txt,pdf,chm,html"} ]
		 */
		});
	} else {
		var uploader = new plupload.Uploader({
			runtimes : 'html5',
			browse_button : uploadIconBtn.attr("id"),
			container : id,
			max_file_size : '100mb',
			url : targetUrl,
			resize : {
				width : 2000,
				height : 2000,
				quality : 100
			}
		/*
		 * filters : [ { title : "Image files", extensions : "jpg,gif,png" }, {
		 * title : "Zip files", extensions : "zip,apk,ipa,plist" }, { title :
		 * "DOC files", extensions :
		 * "doc,docx,xls,xlsx,ppt,pptx,txt,pdf,chm,html" } ]
		 */
		});
	}
	;

	var checkFile = function(file) {
		var filterArray = uploader.settings.filters;
		if (filterArray && filterArray.length > 0) {
			var filePrex = file.name.substr(file.name.lastIndexOf('.') + 1)
					.toLowerCase();
			var nameOK = false;
			for ( var i = 0; i < filterArray.length; i++) {
				var extArray = filterArray[i].extensions.split(",");
				for ( var j = 0; j < extArray.length; j++) {
					if (filePrex == extArray[j].trim().toLowerCase()) {
						nameOK = true;
						break;
					}
				}
				if (nameOK) {
					break;
				}
			}

			if (!nameOK) {
				return false;
			}
		}

		return true;
	};

	uploader.bind('FilesAdded', function(up, files) {
		for ( var i in files) {
			if (!checkFile(files[i])) {
				if (tips) {
					bootbox.alert(tips);
				} else {
					bootbox.alert(files[i].name + " 文件格式不合法！");
				}
				return false;
			}
		}

		for ( var i in files) {
			uploadIconName.html(files[i].name + ' ('
					+ plupload.formatSize(files[i].size) + ') ');
			uploadIconInputName.val(files[i].name);
			uploadIconInputSize.val(files[i].size);
		}
	});

	uploader.bind('QueueChanged', function(up, files) {
		uploader.start();
		stop(files);
	});

	uploader.bind('UploadProgress', function(up, file) {
		uploadIconShow.show();
		// 防止网络慢，没及时改变状态值
		if (file.percent > 0 && file.percent != 100) {
			uploadIconProcess.text((file.percent - 1) + "%");
		}
		// 上传100%,并且已经设置了id值，则显示100%
		var id = uploadIconInput.val();
		if (id != "") {
			uploadIconProcess.text(file.percent + "%");
		}
	});

	uploader.bind('FileUploaded', function(up, files, info) {
		var obj = eval("(" + info.response + ")");
		var id = obj.id;
		uploadIconInput.val(id);
		uploadIconStop.hide();
	});

	var stop = function(files) {
		uploadIconStop.show();
		uploadIconStop.unbind();
		var uploadIconShowEmty = uploadIconShow;
		uploadIconStop.bind('click', function() {
			uploadIconShowEmty.hide();
			uploader.stop();
			if (uploader.files) {
				for ( var i = 0; i < uploader.files.length; i++) {
					uploader.removeFile(uploader.files[i]);
				}
			}
			uploadIconInput.val('');
			uploadIconInputName.val('');
			uploadIconInputSize.val(0);
		});
	}
	uploader.init();
	return uploader;
}